package org.anti996.lms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.anti996.lms.model.Customer;
import org.anti996.lms.model.Warehouse;
import org.anti996.lms.mapper.WarehouseMapper;
import org.anti996.lms.service.WarehouseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 仓库表 服务实现类
 * </p>
 *
 * @author The Anti996 Authors
 * @since 2022-07-15
 */
@Service
public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService {
    @Override//根据仓库名字返回仓库ID
    public Warehouse getIdbywname(String name){
        QueryWrapper<Warehouse> wrapper = new QueryWrapper<>();
        wrapper.eq("name",name);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public List<String> getNamesByKeyword(String name) {
        return baseMapper.getNamesByKeyword('%' + name.trim() + '%');
    }
}
